from fastapi import FastAPI, Query
import uvicorn

app = FastAPI()


@app.get("/")
def index():
    a = 1000
    b = 20
    c = a/b
    return "pong~" + str(c)


@app.get("/users/{user_id}")
def get_user(user_id: int):
    print(user_id)
    return {'userId': user_id}


@app.get("/items_len")
def get_items_len(q: str=Query(None, max_length=5)):
  result = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
  if q:
      result.update({"q": q})
  return result


if __name__ == "__main__":
    uvicorn.run(app=app, host="0.0.0.0", port=3000)
